function accuracy=QDF_Classifier_test(data_fold_path,Omega,omega,omega0,P);
%test the classifier
%Omega,omega,omega0:Gauss distribution discrimination function para
%P:PCA para, reduce the dim
%accuracy: test result

%read data
test_image_name='t10k-images.idx3-ubyte';
test_label_name='t10k-labels.idx1-ubyte';

test_image_full_path=strcat(data_fold_path,test_image_name);
test_label_full_path=strcat(data_fold_path,test_label_name);

images=loadMNISTImages(test_image_full_path);
labels=loadMNISTLabels(test_label_full_path);

%reduce the dim
images_k=P.'*images;

test_data_size=size(images_k,2);

g1=zeros(10,test_data_size);
for i=1:10
    g1(i,:)=diag(images_k.'*[Omega(:,:,i)]*images_k).';
end
g23=omega.'*images_k+repmat(omega0.',1,test_data_size);
g=g1+g23;

[g_max,g_max_index]=max(g);

labels_result=g_max_index.';

labels_result = labels_result-(labels+1);

error_num=find(labels_result);

accuracy=1-size(error_num,1)/test_data_size;

end